-- Viral Resistance - T-Engine 4 Module
-- Copyright (C) 2010 Mikolai Fajer
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Mikolai Fajer "yufra"
-- mfajer@gmail.com

return {
	name = "General Hospital",
	level_range = {1, 1},
	max_level = 2,
	width = 98, height = 39,
	persistant = "zone",
	all_remembered = false,
	all_lited = true,
	generator =  {
		map = {
			class = "engine.generator.map.Static",
		},
--		object = {
--			class = "engine.generator.object.Random",
--			nb_object = {6, 100},
--			filters = { {type="gun" }, {type="ammo" }, {type="medicine" }, {type="medicine" }, {}, {} }
--		},
	},
	levels =
	{
		[0] = {
			generator = {
				map={map="hospital/basement_export"},
				actor={
					class = "engine.generator.actor.Random",
--					nb_npc={5, 15},
					nb_npc={0, 0},
					post_generation = function(m)
						if m.type == "human" then
							m:die()
						elseif m.type == "zombie" and rng.percent(25) then
							m:die()
						end
					end,
				},
			},
			-- Add some broken conduits
			post_process = function(level)
				local quest = game.player:hasQuest("power_loss")
				if quest then
					quest:add_broken_conduits(level)
				end
			end,
		},
		[1] = {
			generator = {
				map={map="hospital/first_floor_export"},
				actor={
					class = "engine.generator.actor.Random",
					nb_npc={30, 50},
					post_generation = function(m)
						if m.type == "human" and rng.percent(75) then
							m:die()
						elseif m.type == "zombie" and rng.percent(25) then
							m:die()
						end
					end,
				},
			},
		},
		[2] = {
			generator = {
				map={map="hospital/second_floor_export"},
				actor = {
					class = "mod.class.generator.actor.OpeningScene",
					nb_npc = {50, 60},
					filters = { {type="human"}, },
					nb_patients = {20, 40},
				},
			},
			pre_change = function(player)
				if player:isQuestStatus("code_green", engine.Quest.DONE) then
					return true
				else
					return false, "Code Green is still active."
				end
			end,
		},
		[3] = {
			generator = {
				map={map="hospital/third_floor_export"},
				actor={
					class = "engine.generator.actor.Random",
					nb_npc={30, 50},
					post_generation = function(m)
						if m.type == "human" and rng.percent(75) then
							m:die()
						elseif m.type == "zombie" and rng.percent(25) then
							m:die()
						end
					end,
				},
			},
		},
	},
}
